# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=mercenary
pkgname=ruby-mercenary
pkgver=0.4.0
pkgrel=2
pkgdesc='Easier way to build your command-line scripts'
url='https://github.com/jekyll/mercenary'
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/jekyll/mercenary/archive/v${pkgver}.tar.gz)
sha256sums=('f13f405287a0690b6cbfba900493c3b00e680e7a5c2d45e0ed869520c04b9d81')
sha512sums=('8399887c3a24daa9329a69dc99804934a30f5b91b6742698a048db7810448b12479a0761a7dc12f63db813da81251482394d1d30a2535710f96285b96dc5a4ac')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec # don't give a fuck about rubys bla bla
  sed 's|git ls-files|find|' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 examples/* -t "${pkgdir}/usr/share/doc/${pkgname}/example"
  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"
}

# vim: ts=2 sw=2 et:
